<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        html,body{
            padding: 0px;
            margin: 0px;
            height: 100%;

            display: flex;
            justify-content: center;
            align-items: center;
            flex-flow: row nowrap;
        }

        .container{
            width: 500px;
            height: 500px;
            background-color: lightgray;
        }

        .box{
            box-sizing: border-box;
            width: 100px;
            height: 100px;
            border: 1px solid black;
            float: left;
        }
    </style>
</head>
<body>
    <div class="container">
        <div>父容器</div>
        <div class="box">浮动子元素</div>
        <div class="box">浮动子元素</div>
        <div class="box">浮动子元素</div>
        <div class="box">浮动子元素</div>
        <div class="box">浮动子元素</div>
        <div class="box">浮动子元素</div>
        <div class="box">浮动子元素</div>
        <div class="box">浮动子元素</div>
        <div class="box">浮动子元素</div>
    </div>
</body>
</html>